/**
 * Created by chocolate on 16/4/28.
 */
'use strict'

import React, {
	Component,
	View,
	Navigator,
	Text,
	StyleSheet,
}from 'react-native';

var HomePage = require('./HomePage');
var UsrLogin = require('./Login');
var Register = require('./Register');
var ParentMain = require('./ParentMain');
var Binding = require('./Binding');
var NoticeList = require('./NoticeList');
var NoticeScreen = require('./NoticeScreen');
var LeaveList = require('./LeaveList');
var LeaveScreen = require('./LeaveScreen');
var DiCalendar = require('./DiCalendar');
var ChatScreen = require('./ChatScreen');
var Course = require('./Course');
var PickPhoto = require('./PickPhoto');
var TakePhoto = require('./TakePhoto');
var ChoosePhoto = require('./ChoosePhoto');
var ModifyPwd = require('./ModifyPwd');
var NotifySetting = require('./NotifySetting');
var About = require('./About');
var SimuEvent = require('./SimuEvent');
var Address = require('./Address');
class AppNav extends Component{

	constructor(props){
		super(props);
		this.state = {};
	}

	renderScene(router,navigator){
		var Component = router.component;
		switch(router.name) {
			case "HomePage":
				Component = HomePage;
				break;
			case "login":
				Component = UsrLogin;
				break;
			case "Register":
				Component = Register;
				break;
			case "Bind":
				Component = Binding;
				break;
			case "ParentMain":
				Component = ParentMain;
				break;
			case "NoticeList":
				Component = NoticeList;
				break;
			case "NoticeScreen":
				Component = NoticeScreen;
				break;
			case "LeaveList":
				Component = LeaveList;
				break;
			case "LeaveScreen":
				Component = LeaveScreen;
				break;
			case "DiCalendar":
				Component = DiCalendar;
				break;
			case "Course":
				Component = Course;
				break;
			case "ChatScreen":
				Component = ChatScreen;
				break;
			case "PickPhoto":
				Component = PickPhoto;
				break;
			case "TakePhoto":
				Component = TakePhoto;
				break;
			case "ChoosePhoto":
				Component = ChoosePhoto;
				break;
			case "ModifyPwd":
				Component = ModifyPwd;
				break;
			case "NotifySetting":
				Component = NotifySetting;
				break;
			case "About":
				Component = About;
				break;
			case "SimuEvent":
				Component = SimuEvent;
				break;
			case "Address":
				Component = Address;
				break;
			default:
				Component = UsrLogin;
		}
		return <Component {...router.params} navigator={navigator}/>;
	}
	
	render(){
		return(
			<Navigator
				initialRoute = {{name:'HomePage'}}
				configureScene={(route)=>{   //箭头函数
					if (route.sceneConfig) {
						return route.sceneConfig;
					}
					return Navigator.SceneConfigs.FloatFromRight;
				}}
				renderScene = {this.renderScene}//定义回调函数,不能带()
			/>
		) 
	}
}

module.exports = AppNav;

